package com.htudata.alarm.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Service;

@Service
public class AlarmDetailDemoService {

  public JSONArray getAlarmDetailsByAlarmId(long alarmId, String a2) {
    JSONArray alarmData = new JSONArray();
    if (alarmId == 1L) {
      JSONObject september = new JSONObject();
      september.put("month", "九月");
      JSONArray septemberDataArr = new JSONArray();
      JSONObject septemberData1 = new JSONObject();
      septemberData1.put("alarmTime", "20190909 17:19:51");
      septemberData1.put("recoveryTime", "20190909 17:20:55");
      septemberData1.put("duration", "64s");
      septemberData1.put("status", "问题");
      septemberData1.put("ack", "不");
      septemberDataArr.add(septemberData1);
      JSONObject septemberData2 = new JSONObject();
      septemberData2.put("alarmTime", "20190906 17:19:01");
      septemberData2.put("recoveryTime", "20190906 17:19:10");
      septemberData2.put("duration", "9s");
      septemberData2.put("status", "已解决");
      septemberData2.put("ack", "不");
      septemberDataArr.add(septemberData2);
      JSONObject septemberData3 = new JSONObject();
      septemberData3.put("alarmTime", "20190905 17:14:48");
      septemberData3.put("recoveryTime", "20190905 18:14:49");
      septemberData3.put("duration", "1h 1s");
      septemberData3.put("status", "已解决");
      septemberData3.put("ack", "不");
      septemberDataArr.add(septemberData3);
      JSONObject septemberData4 = new JSONObject();
      septemberData4.put("alarmTime", "20190902 17:04:43");
      septemberData4.put("recoveryTime", "20190902 17:06:43");
      septemberData4.put("duration", "2m");
      septemberData4.put("status", "已解决");
      septemberData4.put("ack", "不");
      septemberDataArr.add(septemberData4);
      JSONObject septemberData5 = new JSONObject();
      septemberData5.put("alarmTime", "20190901 17:04:43");
      septemberData5.put("recoveryTime", "20190901 17:24:43");
      septemberData5.put("duration", "20m");
      septemberData5.put("status", "已解决");
      septemberData5.put("ack", "不");
      septemberDataArr.add(septemberData5);
      september.put("data", septemberDataArr);
      alarmData.add(september);
      JSONObject august = new JSONObject();
      august.put("month", "八月");
      JSONArray augustDataArr = new JSONArray();
      JSONObject augustData1 = new JSONObject();
      augustData1.put("alarmTime", "20190809 17:19:01");
      augustData1.put("recoveryTime", "20190809 17:19:10");
      augustData1.put("duration", "9s");
      augustData1.put("status", "已解决");
      augustData1.put("ack", "不");
      augustDataArr.add(augustData1);
      JSONObject augustData2 = new JSONObject();
      augustData2.put("alarmTime", "20190806 17:14:48");
      augustData2.put("recoveryTime", "20190806 18:14:49");
      augustData2.put("duration", "1h 1s");
      augustData2.put("status", "已解决");
      augustData2.put("ack", "不");
      augustDataArr.add(augustData2);
      august.put("data", augustDataArr);
      alarmData.add(august);
      JSONObject july = new JSONObject();
      july.put("month", "七月");
      JSONArray julyDataArr = new JSONArray();
      JSONObject julyData1 = new JSONObject();
      julyData1.put("alarmTime", "20190709 17:19:01");
      julyData1.put("recoveryTime", "20190709 17:19:10");
      julyData1.put("duration", "9s");
      julyData1.put("status", "已解决");
      julyData1.put("ack", "不");
      julyDataArr.add(julyData1);
      JSONObject julyData2 = new JSONObject();
      julyData2.put("alarmTime", "20190706 17:14:48");
      julyData2.put("recoveryTime", "20190706 18:14:49");
      julyData2.put("duration", "1h 1s");
      julyData2.put("status", "已解决");
      julyData2.put("ack", "不");
      julyDataArr.add(julyData2);
      july.put("data", julyDataArr);
      alarmData.add(july);
    } 
    return alarmData;
  }
}
